Shift array method in javascript example